In a conventional mobile network, a data communication path between terminals needs to pass through a core network entity such as a serving gateway (SGW)/a packet data gateway (PGW). Therefore, even when data is transferred between two terminals that are very close to each other, the data needs to be transferred through a core network. Consequently, a required amount of network transmission bandwidth is relatively large, and transmission efficiency is relatively low.
To resolve this problem, a ProSe subject is proposed. ProSe requires that data exchange be directly performed between terminals, or data exchange is performed through only a base station but not the core network entity such as an SGW/a PGW. Therefore, communication efficiency between terminals that are relatively close to each other can be improved.
To implement direct communication between terminals, two terminals need to perform mutual discovery. In some approaches, when two terminals perform mutual discovery, and when a first terminal registers with a network that can be listened on by a second terminal, to perform broadcasting, a codeword that is of a ProSe application (APP) identity (ID) and that is broadcast by the first terminal is obtained from a home public land mobile network (HPLMN) of the first terminal, and carries PLMN ID information of the HPLMN of the first terminal; a codeword or mask that is of a ProSe APP ID and that is obtained through listening by the second terminal is obtained from the network that can be listened on by the second terminal, and carries PLMN ID information of the network that can be listened on by the second terminal. However, a PLMN ID of the HPLMN of the first terminal may be different from a PLMN ID of the network that can be listened on by the second terminal. Therefore, in a terminal discovery process in a roaming scenario, in a process of listening to the codeword of the ProSe APP ID by the second terminal in the network that can be listened on by the second terminal, the PLMN ID of the HPLMN of the first terminal cannot match the PLMN ID of the network that can be listened on by the second terminal, and consequently the second terminal cannot obtain, through listening, the codeword that is of the ProSe APP ID and that is broadcast by the first terminal. As a result, the first terminal is ignored, and the second terminal cannot acquire ProSe application information, for example, information such as an address, a phone number, and/or a discount, broadcast by the first terminal, which ultimately results in that the second terminal cannot discover the first terminal.